﻿using FakeXiecheng.API.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FakeXiecheng.API.DataBase
{
    public class AppDbContext : DbContext
    {
        public AppDbContext(DbContextOptions<AppDbContext> options)
            : base(options)
        {

        }
        public DbSet<TouristRoute> TouristRoutes { get; set; }

        public DbSet<TouristRoutePict> TouristRoutePicts { get; set; }

        //add--DataSeeding
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<TouristRoute>().HasData(new TouristRoute()
            {
                ID = Guid.NewGuid(),
                Title = "ceshititle",
                Description = "shuoming",
                OriginaPrice = 0,
                CreateTime = DateTime.UtcNow
            }); ;
            base.OnModelCreating(modelBuilder);
        }
    }
}
